package com.fr.web.face;

import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import com.fr.report.io.xml.ReportXMLUtils;
import com.fr.report.parameter.Parameter;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class ReportletInfo
  implements XMLReadable, Serializable, Cloneable
{
  private String reporletPath = null;
  private List parameterList = new ArrayList();

  public String getReporletPath()
  {
    return this.reporletPath;
  }

  public void setReporletPath(String paramString)
  {
    this.reporletPath = paramString;
  }

  public int getParameterCount()
  {
    return this.parameterList.size();
  }

  public Parameter[] getParametersToArray()
  {
    return ((Parameter[])this.parameterList.toArray(new Parameter[this.parameterList.size()]));
  }

  public Parameter getParameter(int paramInt)
  {
    return ((Parameter)this.parameterList.get(paramInt));
  }

  public void addParameter(Parameter paramParameter)
  {
    this.parameterList.add(paramParameter);
  }

  public void setParameter(int paramInt, Parameter paramParameter)
  {
    this.parameterList.set(paramInt, paramParameter);
  }

  public void clearParameters()
  {
    this.parameterList.clear();
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isAttr())
    {
      String str;
      if ((str = paramXMLableReader.getAttr("reporletPath")) != null)
        setReporletPath(str);
    }
    if ((paramXMLableReader.isChildNode()) && ("Parameters".equals(paramXMLableReader.getTagName())))
    {
      clearParameters();
      Parameter[] arrayOfParameter = ReportXMLUtils.readParameters(paramXMLableReader);
      if (arrayOfParameter != null)
        this.parameterList.addAll(Arrays.asList(arrayOfParameter));
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("ReportletInfo").attr("reporletPath", getReporletPath());
    ReportXMLUtils.writeParameters(paramXMLPrintWriter, (Parameter[])this.parameterList.toArray(new Parameter[this.parameterList.size()]));
    paramXMLPrintWriter.end();
  }
}